package com.leyou.auth.controller;

import com.leyou.auth.Servcie.SecretService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/client")
public class SecretController {

    @Autowired
    private SecretService secretService;

    /**
     * 验证服务信息，判断是否给与秘钥
     * @param clientId
     * @param secret
     * @return
     */
    @GetMapping("/key")
    public ResponseEntity<String>  getSecretKey(@RequestParam("clientId")String clientId,@RequestParam("secret")String secret){
           String key = secretService.getSecretKey(clientId,secret);
           return ResponseEntity.ok(key);
    }
}
